const fs = require("fs");

title = ["button", "col", "input", "row", "switch"];
for (const t of title) {
  fs.truncate(`${t}.vue`, 0, (err) => {
    if (err) throw err;

    const capital = "El" + t.charAt(0).toUpperCase() + t.slice(1);
    fs.writeFile(
      `${t}.vue`,
      `
<script setup lang="ts">
import { ref } from "vue";

const props = defineProps(["config", "style"]);
const value = ref("");

const emit = defineEmits(["update:modelValue"]);
emit("update:modelValue", value);
</script>

<template>
  <div :style="props.style">
    <${capital} v-bind="props.config" v-model="value">${t}</${capital}>
  </div>
</template>

        `,
      (err) => {
        if (err) throw err;
        console.log(`${t}.tsx -----!`);
      }
    );
  });
}
